package com.zuxia.rabbit.produce;

import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.time.Duration;

@Component
public class OrderSender {
//    @Value("${app.rabbitmq.delay.order}")
//    private Duration delayTime;
//    @Value("${app.rabbitmq.exchange.order.delay}")
//    private String orderExchange;
//    @Resource
//    private RabbitTemplate rabbitTemplate;
//
//    public void send(String orderId){
//        rabbitTemplate.convertAndSend(orderExchange,"order.delay.abc",orderId,message -> {
//            MessageProperties messageProperties = message.getMessageProperties();
//            messageProperties.setDelay((int) delayTime.toMinutes());
//            return message;
//        });
//        System.out.println("订单投递"+orderId);
//    }
}
